package com.hmy.finance.api.bo.core.request.enums;


import lombok.Getter;

@Getter
public enum OffsetVoucherStatusEnum {

    UN_OFFSET(0, "未核销", "未核销"),
    PARTAIL_OFFSET(1, "部分核销", "部分核销"),
    OFFSETED(2, "已核销", "已核销");

    /**
     * 状态code
     */
    private Integer statusCode;

    /**
     * 前端显示状态
     */
    private String displayDesc;

    /**
     * 状态描述
     */
    private String statusDesc;

    OffsetVoucherStatusEnum(Integer statusCode, String displayDesc, String statusDesc) {
        this.statusCode = statusCode;
        this.displayDesc = displayDesc;
        this.statusDesc = statusDesc;
    }

    public static String getDisPlayDescByType(Integer type) {
        for (OffsetVoucherStatusEnum offsetVoucherStatusEnum : OffsetVoucherStatusEnum.values()) {
            if (offsetVoucherStatusEnum.getStatusCode().intValue() == type) {
                return offsetVoucherStatusEnum.getDisplayDesc();
            }
        }
        return null;
    }

    public static OffsetVoucherStatusEnum getEnumByType(Integer type) {
        for (OffsetVoucherStatusEnum offsetVoucherStatusEnum : OffsetVoucherStatusEnum.values()) {
            if (offsetVoucherStatusEnum.getStatusCode().intValue() == type) {
                return offsetVoucherStatusEnum;
            }
        }
        return null;
    }
}
